export const search = (key, location) => {
    return new Promise((resolve, reject) => {
        fetch(`https://restapi.amap.com/v3/geocode/regeo?key=${key}&location=${location}`).then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
             // 解析 JSON 数据
            return response.json();
        }).then(data => {
            resolve(data)
        }).catch(error => {
            reject(error)
        });
    })
}